package com.daikuan.fffkuaiban.base;

import android.os.Bundle;
import android.view.View;

import com.jarhead.common.base.BaseActivity;
import com.stx.xhb.commontitlebar.CustomTitlebar;
import com.daikuan.fffkuaiban.R;
import com.umeng.message.PushAgent;

/**
 * Created by jiming1 on 2016/11/1.
 */
public abstract class ToolBarActivity extends BaseActivity {

    public CustomTitlebar toolbar;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        PushAgent.getInstance(this).onAppStart();
    }

    @Override
    protected void initToobar() {
        toolbar = (CustomTitlebar) findViewById(R.id.toolbar);
        toolbar.setAction(new CustomTitlebar.TitleBarOnClickListener() {
            @Override
            public void performAction(View view) {
                switch (view.getId()) {
                    case R.id.iv_left:
                        onLeftClick();
                        break;
                    case R.id.tv_right:
                        onRightClick();
                        break;
                }
            }
        });
    }

    public void onLeftClick() {
        finish();
    }

    public abstract void onRightClick();
}
